/**
 * FileName: TestController
 * Author:   Leopold
 * Date:     2018/9/28 15:38
 * Description:
 * History:
 */
package cn.mcsys.worker.core.web;

import cn.mcsys.myadmin.common.utils.DateUtils;
import cn.mcsys.myadmin.common.utils.MapUtils;
import cn.mcsys.myadmin.dubbo.service.BackService;
import cn.mcsys.myadmin.modules.air.entity.AirCar;
import cn.mcsys.worker.core.conf.LoadRidePointConfiguration;
import cn.mcsys.worker.core.web.dto.BookingPeopleDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.awt.geom.Point2D;
import java.text.SimpleDateFormat;
import java.util.*;

@Controller
public class TestController {

    @Autowired
    private BackService backService;

    @RequestMapping("bookingCount")
    @ResponseBody
    public Map<String, BookingPeopleDTO> dtos() {
        List<AirCar> cars = backService.getAllCarList();
        Map<String, BookingPeopleDTO> map = new HashMap<>();
        map = creatPointName(map);
//        如果在13:00:00-18.:00:00中车辆状态为已返程则设置为已下班
//        for (AirCar car : cars) {
//            String name = car.getAirRidePoint().getName();
//            switch (name){
//                case "香洲公交总站":
//                    BookingPeopleDTO dto = map.get("香洲公交总站");
//
//            }
//        }

        return map;
    }



    private Map<String, BookingPeopleDTO> creatPointName(Map<String, BookingPeopleDTO> map) {
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String format = dateFormat.format(date);
//        总预约数量(二维码乘车日期计算,按乘车点算),到达人数(航展馆地理围栏),在途人数(判断是否在线路上),未送到人数(总预约-已到达的-在途人数)
        map.put("香洲公交总站", new BookingPeopleDTO(60000, 22000, 10000, 38000, format));
        map.put("体育中心东门", new BookingPeopleDTO(60000, 22000, 10000, 38000, format));
        map.put("九洲城", new BookingPeopleDTO(60000, 22000, 10000, 38000, format));
        map.put("九洲港", new BookingPeopleDTO(60000, 22000, 10000, 38000, format));
        map.put("城轨珠海站", new BookingPeopleDTO(60000, 22000, 10000, 38000, format));
        map.put("前山枢纽站", new BookingPeopleDTO(60000, 22000, 10000, 38000, format));
        map.put("华发商都", new BookingPeopleDTO(60000, 22000, 10000, 38000, format));
        map.put("斗门汽车客运站", new BookingPeopleDTO(60000, 22000, 10000, 38000, format));
        map.put("国际赛车场", new BookingPeopleDTO(60000, 22000, 10000, 38000, format));
        return map;
    }
}
